package com.crm.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.Date;
import java.util.List;

/**
 * The persistent class for the "ROLE" database table.
 * 
 */
@Entity
@Table(name = "\"ROLE\"")
@NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r")
public class Role implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue = 1, allocationSize = 1, name = "ROLE_RID_GENERATOR", sequenceName = "SEQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ROLE_RID_GENERATOR")
	@JSONField(name = "id")
	private Long rid;

	@Temporal(TemporalType.DATE)
	@Column(name = "RCREATE_TIME")
	@JSONField(format = "yyyy-MM-dd")
	private Date rcreateTime;

	@JSONField(name = "text")
	private String rname;

	private String rstatus;

	// bi-directional many-to-many association to Userinfo
	@ManyToMany(mappedBy = "roles")
	@JSONField(serialize = false)
	private List<Userinfo> userinfos;

	// bi-directional many-to-many association to Menubar
	@ManyToMany
	@JoinTable(name = "ROLE_MENUBER", joinColumns = { @JoinColumn(name = "RID") }, inverseJoinColumns = {
			@JoinColumn(name = "MID") })
	@JSONField(serialize = false)
	private List<Menubar> menubars;

	public Role() {
	}

	public Long getRid() {
		return this.rid;
	}

	public void setRid(Long rid) {
		this.rid = rid;
	}

	public Date getRcreateTime() {
		return this.rcreateTime;
	}

	public void setRcreateTime(Date rcreateTime) {
		this.rcreateTime = rcreateTime;
	}

	public String getRname() {
		return this.rname;
	}

	public void setRname(String rname) {
		this.rname = rname;
	}

	public String getRstatus() {
		return this.rstatus;
	}

	public void setRstatus(String rstatus) {
		this.rstatus = rstatus;
	}

	public List<Userinfo> getUserinfos() {
		return this.userinfos;
	}

	public void setUserinfos(List<Userinfo> userinfos) {
		this.userinfos = userinfos;
	}

	public List<Menubar> getMenubars() {
		return this.menubars;
	}

	public void setMenubars(List<Menubar> menubars) {
		this.menubars = menubars;
	}

}